home *** CD-ROM | disk | FTP | other *** search
- Path: qcunix.acc.qc.edu!h3dqc
- From: h3dqc@qcunix.acc.qc.edu (SHAPIRA LEEOR)
- Newsgroups: comp.lang.c
- Subject: DLL Questions
- Date: 22 Feb 1996 08:23:30 GMT
- Message-ID: <4gh962$kpb@news.cuny.edu>
- NNTP-Posting-Host: qcunix.acc.qc.edu
- X-Newsreader: TIN [version 1.1 PL9]
-
- I'm having a little trouble making a DLL function in Visual Basic, Im using
- the VB Standard Edition that one purchases via a college. I compiled the C
- file into a dll via Borland at school. I got no errors (after making certain
- that all the lib and object files were in the proper place) compiling it into
- a dll. I've had my share of problems calling the function in VB (including a
- lovely "Floating Point Error: Division by Zero" and the stanard GP error), and
- I'm stuck at this point. I can't seem to get VB to call the DLL function
- properly.
-
- I've tried compiling the DLL without the IDE, but found it to be
- an ardous task. If anyone can tell me specifically what obj and lib files I
- would need to link in, I'd appreciate it. I've used the following:
-
- Makefile below
- ------------------------------------------------------------------------------
- testl.dll:
- tlink /Twd testl.obj c0s.obj, testl.dll, ,c:\dll\import.lib c:\dll\cs.lib c:\dll\maths.lib c:\dll\fp87.lib, testl.def
-
- testl.obj:
- bcc -c -ms! testl.cpp
- ------------------------------------------------------------------------------
- End Makefile
-
- In any case, please look at the code below, and thanks in advance for
- trudging through all this. Sorry to have had to post such strewn pieces all
- about.
-
-
- VB Code
- ------------------------------------------------------------------------------
- Form1 (general)
- Declare Function MyFunc Lib "mydll.dll" (ByVal single1!, ByVal single2!, ByVal int1%) As Single
-
- module1.bas (general)
- Global single1 as Single
- Global single2 as Single
- Global int1 as Integer
- Global total as Single
-
- Sub Form1_Click()
- single1 = 50000
- single2 = 2.4
- int1 = 120
- total = MyFunc(single1, single2, int1)
- *********** The above line gives me a "Bad DLL calling convention" ***********
- text1.text = total
- End Sub
- ------------------------------------------------------------------------------
- End VB Code
-
-
- C Code
- ------------------------------------------------------------------------------
- /*the C file itself contains the standard LibMain and WEP functions and
- this prototype for the function */
- float FAR PASCAL _export MyFunc(float single_1, float single_2, int my_int);
- ______________________________________________________________________________
- End C Code
-
- Thanks again for taking the time to read this, and for your replies. Much
- appreciated. Please email respond if possible. I am endebted to those that
- offer their assistance.
-
-